{% load static %}
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>食安管家</title>
    <!-- 引用本地 Bootstrap CSS -->
    <link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">
    <!-- 新增认证页面样式 -->
    <link href="{% static 'css/auth.css' %}" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
</head>
<body>
    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg navbar-light navbar-custom">
        <div class="container-fluid">
            <a class="navbar-brand" href="/">食安管家</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav me-auto mb-2 mb-lg-0">
                    {% if user.is_authenticated %}
                        <li class="nav-item">
                            <a class="nav-link" href="/">首页</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="/add/">添加食品</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="/statistics/">统计信息</a>
                        </li>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="{% url 'manage_locations' %}">📦 位置管理</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="{% url 'manage_categories' %}">🗂️ 分类管理</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="{% url 'all_foods' %}">📋 食品列表</a>
                        </li>
                        <!-- <li class="nav-item">
                            <a class="nav-link" href="/categories/">食品分类</a>
                        </li> -->
                    {% endif %}
                </ul>
                <ul class="navbar-nav ms-auto mb-2 mb-lg-0">
                    {% if user.is_authenticated %}
                        <li class="nav-item">
                            <span class="welcome-text">欢迎，{{ user.username }}</span>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="{% url 'logout' %}">退出</a>
                        </li>
                    {% else %}
                        <li class="nav-item">
                            <a class="nav-link" href="{% url 'login' %}">登录</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="{% url 'register' %}">注册</a>
                        </li>
                    {% endif %}
                </ul>
            </div>
        </div>
    </nav>

    <!-- 页面内容 -->
    <div class="container mt-4">
        {% block content %}{% endblock %}
    </div>

    <!-- 引用本地 Bootstrap JS -->
    <!-- <script src="{% static 'js/chart.min.js' %}"></script> -->
    <script src="{% static 'js/bootstrap.bundle.min.js' %}"></script>
</body>
</html>